package com.gee.spring.boot.influxdb.core.convertor;

import java.time.Instant;
import java.time.LocalDateTime;
import java.time.ZoneId;

import static com.gee.spring.boot.influxdb.core.util.InfluxdbUtil.NANOSECONDS_PER_SECOND;
import static com.gee.spring.boot.influxdb.core.util.TimeUtil.nanosToTime;
import static com.gee.spring.boot.influxdb.core.util.TimeUtil.timeToNanos;


/**
 * @author gepengjun
 * @since 2024/4/24 14:05
 */
public class LocalDateTimeNanosConvertor implements Convertor<LocalDateTime, Long> {

    @Override
    public LocalDateTime toJavaValue(Long nanos) {
        return nanosToTime(nanos);
    }

    @Override
    public Long toSaveValue(LocalDateTime localDateTime) {
        return timeToNanos(localDateTime);
    }
}
